package com.yue.lin.controller;

import com.yue.lin.entity.Teacher;
import com.yue.lin.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhengyl
 * @description
 * @date 2020-04-23 10:05
 */
@RequestMapping("rest/teacher")
@RestController
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @GetMapping("get")
    public Teacher get(String id) {
        return teacherService.get(id);
    }

    @GetMapping("get2")
    public Teacher get2(String id) {
        return teacherService.get2(id);
    }

    @GetMapping("list")
    public List<Teacher> list(String id) {
        return teacherService.list(id);
    }

    @GetMapping("addBatch")
    public boolean addBatch() {
        return teacherService.addBatch();
    }

    @GetMapping("addBatch2")
    public boolean addBatch2() {
        int i = teacherService.addBatch2();
        return true;
    }

    @GetMapping("add")
    public boolean add() {
        Teacher teacher = new Teacher();
        teacher.setName("sss");
        teacher.setAge(1);
        teacher.setAddress("aaa");
        int add = teacherService.add(teacher);
        return true;
    }
}
